package com.bona.dubbo.system.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.bona.dubbo.system.ISysFunctionDubboSV;
import com.bona.model.system.SysDataRuleModel;
import com.bona.model.system.SysFunctionModel;
import com.bona.model.system.SysIconModel;
import com.bona.model.system.SysOperationModel;
import com.bona.service.system.SysDataRuleService;
import com.bona.service.system.SysFunctionService;
import com.bona.service.system.SysIconService;
import com.bona.service.system.SysOperationService;

public class SysFunctionDubboSVImpl implements ISysFunctionDubboSV {

	@Autowired
	private SysFunctionService functionService;
	@Autowired
	private SysOperationService operationService;
	@Autowired
	private SysDataRuleService dataRuleService;
	@Autowired
	private SysIconService iconService;
	
	@Override
	public SysFunctionModel query(SysFunctionModel model) {
		return functionService.query(model);
	}
	
	@Override
	public Integer queryByCount(SysFunctionModel model) {
		return functionService.queryByCount(model);
	}

	@Override
	public List<SysFunctionModel> queryByPage(SysFunctionModel model) {
		return functionService.queryByPage(model);
	}

	@Override
	public void addOrUpdate(SysFunctionModel model) {
		functionService.addOrUpdate(model);
	}

	@Override
	public void deleteFunction(String funcId) {
		
		functionService.deleteFunction(funcId);
	}

	@Override
	public Integer queryOperationByCount(SysOperationModel model) {
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("model", model);
		return operationService.queryByCount(map);
	}

	@Override
	public List<SysOperationModel> queryOperationByPage(SysOperationModel model) {
		List<SysOperationModel> models = operationService.queryByPage(model);
		return models;
	}

	@Override
	public Integer queryDataRuleByCount(SysDataRuleModel model) {
		return dataRuleService.queryByCount(model);
	}

	@Override
	public List<SysDataRuleModel> queryDataRuleByPage(SysDataRuleModel model) {
		List<SysDataRuleModel> models = dataRuleService.queryByPage(model);
		return models;
	}

	@Override
	public SysOperationModel queryOperation(SysOperationModel model) {
		return operationService.query(model);
	}

	@Override
	public void addOrUpdateOperation(SysOperationModel model) {
		operationService.addOrUpdate(model);
	}

	@Override
	public SysDataRuleModel queryDataRuleById(String id) {
		
		SysDataRuleModel model = new SysDataRuleModel();
		model.setId(id);
		model = dataRuleService.query(model);
		return model;
	}

	@Override
	public void addDataRule(SysDataRuleModel model) {
		dataRuleService.add(model);
	}

	@Override
	public SysDataRuleModel queryDataRule(SysDataRuleModel model) {
		SysDataRuleModel dataRule = dataRuleService.query(model);
		return dataRule;
	}

	@Override
	public Integer deleteOperation(String... ids) {
		
		int count = operationService.delete(ids);
		return count;
	}

	@Override
	public Integer deleteDataRule(String... ids) {
		
		int count = dataRuleService.delete(ids);
		return count;
	}

	@Override
	public SysIconModel queryIcon(SysIconModel model) {
		return iconService.query(model);
	}
	
	@Override
	public Integer queryIconByCount(SysIconModel model) {
		return iconService.queryByCount(model);
	}

	@Override
	public List<SysIconModel> queryIconByPage(SysIconModel model) {
		List<SysIconModel> icons = iconService.queryByPage(model);
		return icons;
	}
	
	@Override
	public void addOrUpdateIcon(SysIconModel model) {
		iconService.addOrUpdate(model);
	}
	
	@Override
	public void deleteIcon(SysIconModel model) {
		iconService.delete(model);
	}

}
